package com.xiaobai.customer;

import com.alibaba.fastjson.JSON;
import com.xiaobai.customer.response.ResponseResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

import javax.annotation.Resource;

@RestController
public class OrderZKController {
    public static final String INVOKE_URL = "http://service-1";


    @Resource
    private RestTemplate restTemplate;

    @Autowired
    private PaymentFeignService paymentFeignService;

    @GetMapping(value = "/consumer/payment/zk")
    public String paymentInfo() {
        return restTemplate.getForObject(INVOKE_URL + "/payment/zk", String.class);
    }

    @GetMapping(value = "/consumer/payment/feign")
    public ResponseResult<String> paymentFeignInfo() {
       return ResponseResult.success(JSON.toJSONString(paymentFeignService.paymentzk()) + paymentFeignService.paymentzk1());
    }
}
